package tutor.mgl;

import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.*;
import android.widget.RadioGroup.OnCheckedChangeListener;

public class TutotialOne extends Activity implements OnCheckedChangeListener{
	TextView textOut;
	EditText getInput;
	RadioGroup rgGravity;
	RadioGroup rgStyle;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tutorone);
		
		textOut = (TextView) findViewById(R.id.tvGetUnput);
		getInput = (EditText) findViewById(R.id.etInput);
		Button btnOk = (Button) findViewById(R.id.btnOk);

		rgGravity = new RadioGroup(this);
		rgGravity.setOnCheckedChangeListener(this);
//		rgStyle;
		
		btnOk.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				textOut.setText(getInput.getText());

			}
		});
	}

	public void onCheckedChanged(RadioGroup arg0, int arg1) {
		// TODO Auto-generated method stub
		switch(arg1){
			case R.id.rbLeft:
				textOut.setGravity(Gravity.LEFT);
				break;
			case R.id.rbCenter:
				textOut.setGravity(Gravity.CENTER);
				break;
			case R.id.rbRight:
				textOut.setGravity(Gravity.RIGHT);
				break;
			case R.id.rbItalic:
				textOut.setTypeface(Typeface.defaultFromStyle(Typeface.ITALIC), Typeface.ITALIC);
				break;
			case R.id.rbBold:
				textOut.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD), Typeface.BOLD);
				break;
			case R.id.rbNormal:
				textOut.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL), Typeface.NORMAL);
				break;
		}
		
	}
	
}
